package cc.imos.communal.err;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * 错误异常
 * Created by asher on 2017/3/11.
 */

@Data
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class ErrException extends Exception {

    private String code;
    private String message;

    public ErrException(ErrCode errCode) {
        this.code = errCode.name();
        this.message = errCode.getMessage();
    }

    public ErrException(ErrCode errCode, String message) {
        this.code = errCode.name();
        this.message = message;
    }

    public ErrException(String code, String message, Throwable cause) {
        super(cause);
        this.code = code;
        this.message = message;
    }
}
